package cc.cary.warehouse.client;

import cc.cary.warehouse.client.annotation.RequestSigned;
import cc.cary.warehouse.client.config.MySuccessCondition;
import cc.cary.warehouse.client.dto.DataDTO;
import cc.cary.warehouse.client.dto.RespDTO;
import cc.cary.warehouse.client.form.PostRequestForm;
import cc.cary.warehouse.client.config.RequestSignedInterceptor;
import com.dtflys.forest.annotation.*;

import java.util.concurrent.Future;

/**
 * @author Cary
 * @date 2023/4/23
 */
@BaseRequest(interceptor = {RequestSignedInterceptor.class})
@Success(condition = MySuccessCondition.class)
public interface RequestClient {
    @Post(value = "{testPostUrl}")
    @RequestSigned
    RespDTO<String> testPost(@JSONBody PostRequestForm form);

    @Get(value = "{testGetUrl}")
    @RequestSigned
    RespDTO<DataDTO> testGet(@Query("name") String name);

    @Get(value = "{testGetUrl}", async = true)
    @RequestSigned
    Future<RespDTO<DataDTO>> testAsyncGet(@Query("name") String name);
}
